/* 
 * File:   TimedUpdater.cpp
 * Author: RedEyedKiller
 * 
 * Created on 17 Σεπτέμβριος 2010, 4:26 πμ
 */

#include "TimedUpdater.h"
#include <SDL/SDL_timer.h>

TimedUpdater::TimedUpdater()
{
    lastUpdate = 0;
}

TimedUpdater::~TimedUpdater()
{
}

void TimedUpdater::Reset()
{
    lastUpdate = 0;
}

bool TimedUpdater::Update(unsigned long interval)
{
    unsigned long now = SDL_GetTicks();
    if(now > lastUpdate + interval)
    {
        lastUpdate = now;
        return true;
    }
    return false;
}